<?php
require_once "checklogin.php";
require_once "../lib/MySQLDB.class.php";
require_once "../lib/function.php";
$db=MySQLDB::getInstance();
if($_POST){
    $data["userPwd"]=$_POST['userPwd'];
    $data["userName"]=$_POST['userName'];
    $data["uswrRoleID"]=$_POST["userRoleID"];
    $data["userID"]=$_POST["userID"];
    $sql="update admininfo set userName=?,userPwd=?,userRoleID=? where userID = ? ";
    $res=$db->query($sql,"ssis",$data);
    if($res){
        layerAlert("管理员修改成功！",1,"adminList.php");
    }else{
        layerAlert("管理员修改失败！",5,"adminList.php");
    }
}else{
    $sql="select * from admininfo where userID=? ";
    $row=$db->fetchRow($sql,'i',$_GET);
    require_once "view/adminEdit.html";
}